package com.meetingshow.commu.service.util;

import java.util.Map;

import org.apache.commons.lang.StringUtils;

import com.meetingshow.common.base.dao.model.QueryStruct;
import com.meetingshow.common.base.service.BaseQueryParasBuilder;
import com.meetingshow.commu.service.model.QuestionQueryParas;

public class QuestionQueryParasBuilder extends BaseQueryParasBuilder {
    public static QueryStruct questionQueryBuilder(
            QueryStruct queryStruct, QuestionQueryParas questionQueryParas)
            throws Exception {
        
        builderInit(questionQueryParas, queryStruct);

        Map<String, Object> exactMap = queryStruct.getExactMap();
        
        if (StringUtils.isNotBlank(questionQueryParas.getQuestionId_e())) {
            exactMap.put(QuestionServiceParas.QUESTION_PO_QUESTION_ID, Integer.valueOf((questionQueryParas.getQuestionId_e())));
        }
        
        if (StringUtils.isNotBlank(questionQueryParas.getFromUserId_e())) {
            exactMap.put(QuestionServiceParas.QUESTION_PO_FROM_USER_ID, Integer.valueOf((questionQueryParas.getFromUserId_e())));
        }
        
        if (StringUtils.isNotBlank(questionQueryParas.getToUserId_e())) {
            exactMap.put(QuestionServiceParas.QUESTION_PO_TO_USER_ID, Integer.valueOf((questionQueryParas.getToUserId_e())));
        }
        
        if (StringUtils.isNotBlank(questionQueryParas.getTopicId_e())) {
            exactMap.put(QuestionServiceParas.QUESTION_PO_TOPIC_ID, Integer.valueOf((questionQueryParas.getTopicId_e())));
        }
        
        
        pageBuilder(queryStruct, questionQueryParas);
        
        return queryStruct;
    }
}
